//
//  UIBarButtonItem+Extension.m
//  TJSinaWeiBo_OC
//
//  Created by 唐后能 on 16/4/27.
//  Copyright © 2016年 itheima. All rights reserved.
//

#import "UIBarButtonItem+Extension.h"

@implementation UIBarButtonItem (Extension)
+(UIBarButtonItem *)normalImgName:(NSString*)normalImgName andHighlightImgName:(NSString*)highlightImgName andTarget:(id) target action:(SEL)action {
    
    UIButton *btn = [[UIButton alloc] init];
    
    // 设置背景颜色.
    [btn setBackgroundImage:[UIImage imageNamed:normalImgName] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:highlightImgName] forState:UIControlStateHighlighted];
    [btn sizeToFit];
    [btn  addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return [[UIBarButtonItem alloc] initWithCustomView:btn];
}

@end
